<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

    <xsl:template match="/root">
          <table class="datatable" border="0" cellpadding="0" cellspacing="0">
            <tr>
				<th>Ref</th>
				<th>Date</th>
				<th>SubTotal</th>
				<th>Tax</th>
				<th>Deposit</th>
				<th>Total</th>
				<th>Paid</th>
				<th>Due</th>
            </tr>
			  
            <xsl:for-each select="/root/item">
			<xsl:sort select="./genxml/hidden/dtedate" data-type="text" order="ascending"/>
              <tr>
                <td>
					<xsl:value-of select="./genxml/hidden/invoiceref" disable-output-escaping="yes"/>
				</td>
                <td>
					<xsl:value-of select="substring(./genxml/hidden/dtedate,1,10)" disable-output-escaping="yes"/>
				</td>
<td>
<xsl:value-of select="genxml/hidden/dblht" disable-output-escaping="yes"/>
</td>
<td>
<xsl:value-of select="genxml/hidden/dbltax" disable-output-escaping="yes"/>
</td>
<td>
<xsl:value-of select="genxml/hidden/dblpaid" disable-output-escaping="yes"/>
</td>              
<td>
<xsl:value-of select="genxml/hidden/dbldue" disable-output-escaping="yes"/>
</td>              
<td>
<xsl:value-of select="genxml/hidden/dblactualpaid" disable-output-escaping="yes"/>
</td>              
<td>
<xsl:value-of select="genxml/hidden/dbltotaldue" disable-output-escaping="yes"/>
</td>              

</tr>
            </xsl:for-each>

          </table>

		
    </xsl:template>

</xsl:stylesheet>
